Skip to content

Implement default PlayerDisplayNameProvider API#803

Draft
TechnicJelle wants to merge 3 commits into
BlueMap-Minecraft:masterfrom
TechnicJelle:master
Draft

Implement default PlayerDisplayNameProvider API#803
TechnicJelle wants to merge 3 commits into
BlueMap-Minecraft:masterfrom
TechnicJelle:master

Conversation

@TechnicJelle
Copy link
Copy Markdown
Member

@TechnicJelle TechnicJelle commented May 12, 2026

Implemented a default for the API added in BlueMap-Minecraft/BlueMapAPI#9

I'm not all too happy about it all yet, especially the locations of some things and what I had to pass into other places.
Also, the default implementation currently kind of sucks.

I'd be happy to get feedback on this!

Screenshots of this working image image image
Addon plugin code
package com.TechnicJelle.blueMapCustomPlayerNames;

import de.bluecolored.bluemap.api.BlueMapAPI;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.TextComponent;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;

import java.util.function.Consumer;

public final class BlueMapCustomPlayerNames extends JavaPlugin {

    @Override
    public void onEnable() {
        BlueMapAPI.onEnable(bluemapOnEnable);
    }

    Consumer<BlueMapAPI> bluemapOnEnable = (BlueMapAPI api) -> {
        api.getPlugin().setPlayerNameProvider(playerUUID -> {
            Player player = getServer().getPlayer(playerUUID);
            if (player == null) return playerUUID.toString();

            Component displayName = player.displayName();
            if (displayName instanceof TextComponent textComponent)
                return "<span style=\"color: blue;\">" + textComponent.content() + "</span>";

            return playerUUID.toString();
        });
    };
}

@TechnicJelle TechnicJelle requested a review from TBlueF May 21, 2026 01:15
BmMap map = maps.get(id);
if (map != null) {
mapRequestHandler = new MapRequestHandler(map, serverInterface, pluginConfig, Predicate.not(pluginState::isPlayerHidden));
mapRequestHandler = new MapRequestHandler(playerDisplayNameProvider, map, serverInterface, pluginConfig, Predicate.not(pluginState::isPlayerHidden));
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah .. so this wont work either, since the variable is not initialized here, and if you change the variable via API after bluemap is loaded, it won't update either.. 😅
I'll take a look at this in a bit, rn i don't like any of the "easy" solutions to pass the information through to the LivePlayerDataProvider correctly..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants